<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册-${_front_title}</title>
<meta name="keywords" content="${_front_keywords}" />
<meta name="description" content="${_front_description}" />
<script type="text/javascript" src="${_front_js}/jquery.min.js"></script>
<link rel="shortcut icon" href="/static/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="${_front_css}/base.css">
<link rel="stylesheet" type="text/css" href="${_front_css}/login.css">
</head>

<body>
<!--头部开始-->
<#include "./base/top.ftl" />
<!--头部结束-->
<!--reg star -->
<div class="bg_gray">
<div class="registered_topbg"></div>

       <div class="registered reg2">
        <div class="reg-text">
            <div class="reg-title">
                <div class="fl">免费注册</div>
                <div class="fr">已有迅泊达金融账号？<a href="login.html">立即登录</a></div>
            </div>
            <div class="step">
                <div class="fl step1">
                    <span class="step-num">1</span>
                    <p>填写账户信息</p>
                </div>
                <div class="fl step2 current">
                    <span class="step-num current">2</span>
                    <p>手机信息验证</p>
                </div>
                <div class="fl step3">
                    <span class="step-num">3</span>
                    <p>注册成功</p>
                </div>
            </div>
            <div class="clearfix"></div>
            <div class="fl">
                <div class="sign-up-left">
                    <div class="ui-form-item2">
                        <label class="ui-label-sign">
                            	手机号码：
                        </label>
                        <div class="ui-input-number">
                        	<#if phone?exists>
                        		${phone}
                        	</#if>
						</div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="ui-form-item2">
                        <label class="ui-label-sign">
                            <span class="ui-form-required">*</span>验证码：
                        </label>
                        <input class="ui-input" name="" type="text" id="code" placeholder="请输入验证码" style="width: 210px;">
                        <button class="btn-orange-sign time_else" id="codeBtn" style="height: 40px; width: 120px; margin: 0px 0px 0px 10px; background: rgb(252, 66, 85);">获取验证码</button>
                        <div class="clearfix"></div>
                        <div class="wrong" id="cue" style="display:none"></div>
                    </div>
                    <div class="ui-form-item2 btn2">
                        <button class="btn-orange-sign" id="button">验证</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
<!-- END -->
<!--底部开始-->
<#include "./base/foot.ftl" />
<!--底部结束-->
<script type="text/javascript">
	$(document).ready(function(){
		$(".time_else").attr("disabled", true);
		var date = document.getElementById("codeBtn");
		time(date);
		
	})
	
	$(".time_else").click(function(){
		var phone = ${phone} ;
		time(this);
		$.ajax({
            cache: true,
            type: "POST",
            url:"/register/sms/send",
            data:{
            	"phone" : phone
            },
            async: false,
            success: function(data) {
            	
            }
    	});
    })
	
	$("#button").click(function(){
		var phone =${phone} ;
		var code = $("#code").val();
		
		$.ajax({
            cache: true,
            type: "POST",
            url:"/register/save",
            data:{
            	"phone" : phone,
            	"code":code
            },
            async: false,
            success: function(result){
            	if(result.code == -1){
            		window.location.href = "/register/success";
            	}else{
            		alert(result.msg);
            	}
            }
    	});
		
	})
	

    
	var wait=60;
	function time(o) {
		if (wait == 0) {
			o.removeAttribute("disabled");  
			$("#codeBtn").css("background","#fc4255");           
		    $("#codeBtn").html("获取验证码");
		    wait = 60;
		} else {
			o.setAttribute("disabled", true);
			$("#codeBtn").css("background","#666");           
		    $("#codeBtn").html("重新发送(" + wait + ")");
		    wait--;
		    setTimeout(function() {
		        time(o)
		    },
		    1000)
		}
    }
    
</script>
</body>
</html>
